<template>
	<view class="invite">
		<u-navbar back-icon-color="#FFFFFF" title-color="#FFFFFF" :border-bottom="false"
			:background="{background:'#0A0A25'}" :title="i18n.InvitationLink"></u-navbar>
		<view class="tip">
			<view class="f32">{{i18n.Invitation}}</view>
			<view class="f32 mg-t-30">{{code}}</view>
		</view>
		<view class="info">
			<image src="@/static/add/invite-yqt.png"  style="width: 650rpx;height: 700rpx;"></image>
			<view class="btn" @click="copy">{{i18n.copy}}</view>
		</view>
	</view>
</template>

<script>
	var that
	import {
		_updataTabBar,
		pageto,
		fetch
	} from "../../common/js/sysfun.js"
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		data() {
			return {
				code: ''
			}
		},
		onLoad() {

		},
		onShow() {
			this.getData()
		},
		computed: {
			i18n() {
				return this.$t('message');
			},
			...mapGetters([
				'getRequestUrl',
				'getLangType',
				'getTextArr',
				'getLoginInfo'
			])
		},
		methods: {
			...mapMutations([
				'setGgsxq',
				'setLoginInfo',
				'setLogin',
				'setLoginTime',
				'setLangType',
				'setAreas'
			]),

			// 获取首页数据
			getData() {
				that = this
				that.$getAjax('Member/invitation', '', function(res) {
					that.code = res.data
				})
				that.$getAjax('Member/wallet', '', function(res) {
					console.log(res)
				})
			},
			copy() {
				if (!this.code) return
				uni.setClipboardData({
					data: this.getRequestUrl + 'chain/#/?rid=' + this.code,
					showToast: false,
					success: function() {
						uni.showToast({
							icon: 'none',
							title: that.i18n.copysuccess,
							duration: 1000
						});
					}
				})
			},
			pageto(url, pp) {
				pageto(url, pp);
			},
		},
		onReachBottom() {

		},
	}
</script>

<style lang="scss" scoped>
	.invite {
		color: #FFFFFF;
		height: 100vh;
		background-image: url(@/static/add/invite-bg.png);
		background-repeat: no-repeat;
		background-size: 100% 100%;

		.tip {
			margin: 0 130rpx;
			padding: 50rpx 20rpx;
			text-align: center;
			transform: translateY(100rpx);
			border-radius: 20rpx;
			background-color: #010A38;
		}

		.info {
			margin: 0 30rpx;
			padding: 120rpx 20rpx 80rpx;
			border-radius: 40rpx;
			background-color: rgba(81, 95, 140, .5);
			box-shadow: inset -4rpx -4rpx 6rpx 2rpx rgba(81, 95, 140, .5);
		}

		.btn {
			width: 80%;
			margin: 0 auto;
			padding: 30rpx;
			font-size: 30rpx;
			text-align: center;
			border-radius: 20rpx;
			background-color: #43B89C;
		}
	}
</style>